<?php
// +----------------------------------------------------------------------
// | 商品模型
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2022 http://www.yicmf.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 微尘 <yicmf@qq.com>
// +----------------------------------------------------------------------
namespace app\model\store;

use app\model\file\Image;
use app\model\pos\PosVip;
use app\model\ucenter\User;
use think\model\concern\SoftDelete;

class Cart extends Common
{
    use SoftDelete;
    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function posVip()
    {
        return $this->belongsTo(PosVip::class);
    }
    public function good()
    {
        return $this->belongsTo(Good::class,'good_id');
    }

    public function cover()
    {
        return $this->belongsTo(Image::class, 'cover_id')->field('id,name,save_name,driver,url,path');
    }
    /**
     * 写入修改
     * @param $data
     */
    public static function onBeforeInsert($data)
    {
        $data['status'] = 1;
    }
    //类型转换
    protected $type = [];

}
